//语法： interface 泛型接口<Type1,Type2,...>{}

//之前的类型接口
interface IPerson {
    name: string;
    age: number;
    sex?: string;
    run(): string;
    eag(): void
}
let per: IPerson = {
    name: "接口形式",
    age: 12,
    run() {
        console.log("跑");
        return "跑"
    },
    eag() {
        console.log("吃");

    },
}
per.name
console.log("per.name==", per.name);
console.log();
per.age
per.run()
per.eag()


//泛型接口
interface Data<T>{
    status: number,
    msg: string,
    data: T
}
let obj:Data<string[]>={
    status:20,
    msg:'20',
    data:['1','2','3']
}

//复杂一点
interface A{
    title:string,
    id:number
}
interface B{
    name:string,
    id:number
}
interface MyData<T>{
    status:number,
    data:T
}
let res:MyData<A>={
    status:200,
    data:{
        title:"信息",
        id:123
    }
}
//------多个--------------------------
interface MyData2<T,S>{
    status:number,
    data:T,
    info:S
}
let sss:MyData2<A,B>={
    status:200,
    data:{
        title:"信息",
        id:123
    },
    info:{
        name:"信息",
        id:123
    }
}
console.log("sss==",sss);

export {}